package com.endava.FlowControlAndAssertions;

/*	5. Sa se determie numerele prime mai mici de 100. 
 5.1. versiunea cu bucle for
 5.2. versiunea cu bucle while
 */
public class Ex5 {

	public boolean isPrime(int number) {
		for (int i = 2; i < number; i++) {
			if (number % i == 0) {
				return false; // number is divisible so its not prime
			}
		}
		return true; // number is prime now
	}

	public static void main(String[] args) {
		Ex5 ex5 = new Ex5();
		int number = 0;

		for (number = 2; number <= 100; number++) {
			// print prime numbers only
			if (ex5.isPrime(number)) {
				System.out.println(number);

			}
		}

		while (number <= 100) {
			if (ex5.isPrime(number)) {
				System.out.println(number);
			}
			number++;
		}
	}

}
